To subscribe to complex data information, call one of the Subscribe methods on the EasyUAClient Class as usual. When complex data is returned by the client, a DataChangeNotification Event or EventNotification Event will be raised (or a corresponding callback will be made). The value in the event arguments will be of type UAGenericObject Class, and you will process its contents.
How precisely you process the received generic data depends on the application. In general, there can be two usage cases:
- Your application knows the type of the data to expect. In this case, you can hard-code this knowledge into the application. For example, if you know that the received data is a structure that has a field called "Temperature". You would type-cast the received data to StructuredData, and from the FieldData collection, you will get an element indexed by a string "Temperature". This can then be an instance of PrimitiveData Class, containing the temperature value in its Value Property. For more information, see Working with generic data.
- Your application does not know the type of the data to expect. This requires more coding, but is also perfectly doable. You will be accessing the generic data information similarly to the above case, but in a more generic way. The GenericData Class gives you a DataType Property, and the DataType object contained in this property gives you the metadata needed. For more information, see Working with data types.
The example below shows how to subscribe to OPC UA complex data and display the incoming values.
.NET
COM
Complex data is also supported and can also be returned in notifications for OPC UA Alarms&Conditions, i.e. in event arguments of type EasyUAEventNotificationEventArgs, used in the EventNotification Event .
See Also